package com.itheima.guanbing1;

import java.util.concurrent.ArrayBlockingQueue;

public class Cooker implements Runnable {
        private ArrayBlockingQueue<String> queue;
    public Cooker(ArrayBlockingQueue<String> queue) {
        this.queue=queue;
    }

    @Override
    public void run() {
        while (true) {
            // 往保温箱里放
            try {
                queue.put("灌饼");
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"做了一个灌饼放进了保温箱");
        }
    }
}
